home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 64
/
Volume 64 - JOGO DISK .iso
/
Games
/
the_best_every_day.swf
/
scripts
/
__Packages
/
MCGary.as
< prev
next >
Wrap
Text File
|
2008-04-10
|
2KB
|
101 lines
class MCGary extends MCObstacles
{
var STRING_TYPE = "Gary";
static var NUMBER_SPEED = 2;
static var NUMBER_SLOBBER = 15;
function MCGary()
{
super(this.STRING_TYPE);
this.gotoAndStop("Hide");
this.Etat = "Hide";
}
function setObstacle()
{
if(this.Etat == "Hide")
{
this.fShow();
this.onRelease = this.fHide;
}
}
function fShow()
{
this.Etat = "Appear";
this.gotoAndStop("Appear");
}
function fHide()
{
this.Etat = "Disapear";
this.gotoAndStop("Disapear");
this.deactivate();
delete this.onRelease;
}
function fUpdate()
{
if(!_global.Pack.bPaused)
{
var _loc3_ = undefined;
if(this._xscale > 0)
{
_loc3_ = 1;
}
else
{
_loc3_ = -1;
}
this._x += MCGary.NUMBER_SPEED * _loc3_;
this.addSlobber();
this.FearEdge();
}
}
function addSlobber()
{
this.nSlobber = this.nSlobber - 1;
if(this.nSlobber <= 0 && _global.C.oGame.oLevel.oObstacleManager.garyCollide())
{
var _loc4_ = this._parent.SlobberPast.getNextHighestDepth();
var _loc3_ = this._parent.SlobberPast.attachMovie("slobber","slobber" + _loc4_,_loc4_);
_loc3_._x = this._x;
_loc3_._y = this._y;
this.nSlobber = MCGary.NUMBER_SLOBBER;
}
else if(this.nSlobber <= 0)
{
this.nSlobber = MCGary.NUMBER_SLOBBER;
}
}
function FearEdge()
{
var _loc2_ = new Object({x:this.mcEdgeDetector._x,y:this.mcEdgeDetector._y});
this.localToGlobal(_loc2_);
if(!this._parent.mcFloor.hitTest(_loc2_.x,_loc2_.y,true))
{
this._xscale *= -1;
}
}
function Appear()
{
if(this.Anim._currentframe == this.Anim._totalframes)
{
this.activate();
this.nSlobber = MCGary.NUMBER_SLOBBER;
this.Etat = "Walk";
this.gotoAndStop("Walk");
}
}
function Walk()
{
this.fUpdate();
}
function Disapear()
{
if(this.Anim._currentframe == this.Anim._totalframes)
{
this.Etat = "Hide";
this.gotoAndStop("Hide");
}
}
function Hide()
{
}
}